home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 2
/
Deutsche Edition 2.iso
/
mac
/
POWERMAC
/
C64
/
SOURCE
/
Printer.c
< prev
next >
Wrap
Text File
|
1994-06-06
|
2KB
|
83 lines
/*
Commodore 64 Emulator v0.4 Earle F. Philhower III
Copyright (C) 1993-4 (st916w9r@dunx1.ocs.drexel.edu)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "Processor.h"
#include "Serial.h"
#include "Printer.h"
#include "FileTypes.h"
#include "Error.h"
static short printerFile;
static byte printerOpen;
static byte PrinterClose(int sa);
static byte PrinterOpen(char *fname, int len, int sa);
static byte PrinterOutput(byte chr, int sa);
static byte PrinterInput(byte *store, int sa);
int PrinterInitialize(void)
{
AddSerialDevice(4, PrinterInput, PrinterOutput, PrinterOpen,
PrinterClose, NULL);
printerOpen=0;
return kNoError;
}
static byte PrinterClose(int sa)
{
if (printerOpen==1) FSClose(printerFile);
printerOpen=0;
return kSerialOK;
}
static byte PrinterOpen(char *fname, int len, int sa)
{
if (printerOpen==1) PrinterClose(sa);
FSDelete("\pPRINTER",0);
Create("\pPRINTER",0, APPLTYPE, PRINTERFTYPE);
FSOpen("\pPRINTER",0, &printerFile);
printerOpen=1;
return kSerialOK;
}
static byte PrinterOutput(byte chr, int sa)
{
long len;
char temp;
if (printerOpen==1) {
temp=chr;
len=1;
FSWrite(printerFile, &len, &temp);
return kSerialOK; }
return kSerialError;
}
static byte PrinterInput(byte *store, int sa)
{
return kSerialError;
}
void PrinterNewFile(void) {}
void PrinterAppendFile(void) {}
void PrinterXvertCharacters(void) {}
void PrinterDisplayFile(void) {}